package ke04;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class ZeichenPanel extends JPanel
{

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		
		Graphics2D g2 = (Graphics2D)g;
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		
		g2.setColor(new Color(255, 0, 0, 100));
		g2.fillOval(0, 0, 200, 200);
		
		g2.setColor(new Color(0,0, 255));
		g2.drawRect(10, 10, 100, 100);
	}
	
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			
			@Override
			public void run() {
				JFrame f = new JFrame();
				f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				ZeichenPanel p = new ZeichenPanel();
				p.setPreferredSize(new Dimension(300,300));
				f.getContentPane().add(p);
				f.pack();
				f.setVisible(true);
			}
		});
	}
}
